package uitest 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Rectangle;
	import iscript.uiFramework.components.layout.ViewPortLayout;
	import iscript.uiFramework.UIFramework;
	import iscript.uiFramework.util.LineSegment;
	/**
	 * ...
	 * @author raymond
	 */
	public class viewportTest extends  Sprite
	{
		private var  viewport:ViewPortLayout
		public function viewportTest() 
		{
			var rect:Rectangle = new Rectangle (0, 0, UIFramework.UiStage.stageWidth, UIFramework.UiStage.stageHeight);
			viewport = new ViewPortLayout (rect);
			viewport.minRect = new Rectangle(0, 0, 600, 400);
			viewport.southHeight = 0;
			viewport.updateRect ();
			draw();
			UIFramework.UiStage.addEventListener(Event.RESIZE,resizeLogic)
			trace(viewport.northRect)
			trace(viewport.westRect)
			trace(viewport.centerRect)
			trace(viewport.eastRect)
			trace(viewport.southRect)
		}
		
		private function resizeLogic(e:Event):void 
		{
			var rect:Rectangle = new Rectangle (0, 0, UIFramework.UiStage.stageWidth, UIFramework.UiStage.stageHeight);
			viewport.updateRect (rect);
			draw ()
			
			trace(viewport.northRect)
			trace(viewport.westRect)
			trace(viewport.centerRect)
			trace(viewport.eastRect)
			trace(viewport.southRect)
			
		}
		
		private function draw():void {
			this.graphics.clear()
			var  line:LineSegment = new LineSegment ();
			line.thickness = 1;
			line.drawRectangle (this.graphics, viewport.northRect)
			line.fillColor = 0xFFFFFF;
			line.drawRectangle(this.graphics, viewport.westRect)
			line.fillColor = 0x00FFFF
			line.drawRectangle(this.graphics, viewport.centerRect)
			line.fillColor = 0x800000
			line.drawRectangle(this.graphics, viewport.eastRect)
			line.fillColor = 0xFFFF00
			line.drawRectangle (this.graphics, viewport.southRect)
			}
	}

}